<?php

include("../lib/db.lib");
include("../lib/std.lib");

$table_catalogs="create table catalogs (
cat_id int(11) not null auto_increment, 
primary key(cat_id),
shop_id int(11),
parent_cat int(11),
child_cat int(11),
title varchar(100),
other varchar(100),
date timestamp(14)
)";

$table_products="create table products (
cat_id int(11) not null,
product_id  varchar(100),
primary key(cat_id,product_id),
other  varchar(50),
date timestamp(14),
title  varchar(200),
display_order  int(5)
)";

$table_product_detail="create table product_detail (
product_id  varchar(100),
primary key(product_id),
author varchar(50),
date varchar(12),
title  varchar(200),
display_order  int(5)
)";


//$qry="drop table catalogs";
//if($re = mysql_query($qry)){
//	echo "Table catalogs dropped!<br>\n";
//}


$qry=$table_catalogs;
if($re = mysql_query($qry)){
	echo "Table catalogs created!<br>\n";
}
else{
	echo "Table catalogs failed to be created!<br>\n";
}

$qry=$table_products;
if($re = mysql_query($qry)){
	echo "Table products created!<br>\n";
}
else{
	echo "Table products failed to be created!<br>\n";
}

$qry=$table_product_detail;
if($re = mysql_query($qry)){
	echo "Table product_detail created!<br>\n";
}
else{
	echo "Table product_detail failed to be created!<br>\n";
}

?>
